"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var http_1 = require("@angular/http");
var api_1 = require("../../../config/api");
var LoginService = /** @class */ (function () {
    function LoginService(http, httpService) {
        this.http = http;
        this.httpService = httpService;
    }
    LoginService.prototype.doLogin = function (username, password) {
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify({ account: username, password: password });
        return this.http.post(api_1.adSystemApiUrl + '/v1/member/auth/login', body, options).map(function (response) { return response.json(); });
    };
    LoginService.prototype.register = function (redirectMsg) {
        var url = api_1.adSystemApiUrl + '/v1/member/auth/register';
        return this.httpService.httpPostAuth(url, redirectMsg).map(function (data) { return data; });
    };
    LoginService.prototype.smsSend = function (mobile, type) {
        var url = api_1.adSystemApiUrl + '/v1/common/sms/send';
        return this.httpService.httpPostAuth(url, { mobile: mobile, type: type }).map(function (data) { return data; });
    };
    LoginService.prototype.getTableId = function () {
        var url = api_1.adSystemApiUrl + '/v1/common/captcha/get_table_id';
        return this.httpService.httpGetAuth(url).map(function (data) { return data; });
    };
    LoginService.prototype.checkCode = function (code, table_id) {
        var url = api_1.adSystemApiUrl + ("/v1/common/captcha/api_check?code=" + code + "&table_id=" + table_id);
        return this.httpService.httpGetAuth(url).map(function (data) { return data; });
    };
    LoginService.prototype.passedit = function (passeditMsg) {
        var url = api_1.adSystemApiUrl + '/v1/member/auth/passedit';
        return this.httpService.httpPostAuth(url, passeditMsg).map(function (data) { return data; });
    };
    LoginService.prototype.doLoginAdmin = function (account, password) {
        var url = api_1.adSystemApiUrl + '/v1/admin/auth/login';
        return this.httpService.httpPostAuth(url, { account: account, password: password }).map(function (data) { return data; });
    };
    LoginService = __decorate([
        core_1.Injectable()
    ], LoginService);
    return LoginService;
}());
exports.LoginService = LoginService;
